# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1114 -> 1.1115 # kernel/fork.c 1.119 -> 1.120 # include/asm-ppc64/thread_info.h 1.7 -> 1.8 # include/asm-i386/thread_info.h 1.11 -> 1.12 # include/asm-ppc/thread_info.h 1.7 -> 1.8 # include/asm-parisc/thread_info.h 1.2 -> 1.3 # include/asm-um/thread_info.h 1.3 -> 1.4 # include/asm-h8300/thread_info.h 1.1 -> 1.2 # include/asm-v850/thread_info.h 1.2 -> 1.3 # include/asm-m68knommu/thread_info.h 1.2 -> 1.3 # include/asm-arm/thread_info.h 1.6 -> 1.7 # include/asm-m68k/thread_info.h 1.4 -> 1.5 # include/asm-s390/thread_info.h 1.4 -> 1.5 # include/asm-x86_64/thread_info.h 1.10 -> 1.11 # include/asm-sparc64/thread_info.h 1.10 -> 1.11 # arch/arm/kernel/process.c 1.28 -> 1.29 # include/asm-alpha/thread_info.h 1.5 -> 1.6 # include/asm-sparc/thread_info.h 1.4 -> 1.5 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/06/04 davidm@tiger.hpl.hp.com 1.1115 # Fix task creation/destruction to make it possible for the thread_info and the # task_struct to be next to each other. # -------------------------------------------- # diff -Nru a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c --- a/arch/arm/kernel/process.c Sun Jun 8 00:40:15 2003 +++ b/arch/arm/kernel/process.c Sun Jun 8 00:40:15 2003 @@ -239,7 +239,7 @@ #define ll_alloc_task_struct() ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define ll_free_task_struct(p) free_pages((unsigned long)(p),1) -struct thread_info *alloc_thread_info(void) +struct thread_info *alloc_thread_info(struct task_struct *task) { struct thread_info *thread = NULL; diff -Nru a/include/asm-alpha/thread_info.h b/include/asm-alpha/thread_info.h --- a/include/asm-alpha/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-alpha/thread_info.h Sun Jun 8 00:40:15 2003 @@ -51,7 +51,7 @@ /* Thread information allocation. */ #define THREAD_SIZE (2*PAGE_SIZE) -#define alloc_thread_info() \ +#define alloc_thread_info(tsk) \ ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h --- a/include/asm-arm/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-arm/thread_info.h Sun Jun 8 00:40:15 2003 @@ -84,7 +84,7 @@ #define THREAD_SIZE (8192) -extern struct thread_info *alloc_thread_info(void); +extern struct thread_info *alloc_thread_info(struct task_struct *task); extern void free_thread_info(struct thread_info *); #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h --- a/include/asm-h8300/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-h8300/thread_info.h Sun Jun 8 00:40:15 2003 @@ -65,7 +65,7 @@ } /* thread information allocation */ -#define alloc_thread_info() ((struct thread_info *) \ +#define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, 1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h --- a/include/asm-i386/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-i386/thread_info.h Sun Jun 8 00:40:15 2003 @@ -87,7 +87,7 @@ /* thread information allocation */ #define THREAD_SIZE (2*PAGE_SIZE) -#define alloc_thread_info() ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) +#define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) #define get_thread_info(ti) get_task_struct((ti)->task) #define put_thread_info(ti) put_task_struct((ti)->task) diff -Nru a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h --- a/include/asm-m68k/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-m68k/thread_info.h Sun Jun 8 00:40:15 2003 @@ -28,10 +28,10 @@ /* THREAD_SIZE should be 8k, so handle differently for 4k and 8k machines */ #if PAGE_SHIFT == 13 /* 8k machines */ -#define alloc_thread_info() ((struct thread_info *)__get_free_pages(GFP_KERNEL,0)) +#define alloc_thread_info(tsk) ((struct thread_info *)__get_free_pages(GFP_KERNEL,0)) #define free_thread_info(ti) free_pages((unsigned long)(ti),0) #else /* otherwise assume 4k pages */ -#define alloc_thread_info() ((struct thread_info *)__get_free_pages(GFP_KERNEL,1)) +#define alloc_thread_info(tsk) ((struct thread_info *)__get_free_pages(GFP_KERNEL,1)) #define free_thread_info(ti) free_pages((unsigned long)(ti),1) #endif /* PAGE_SHIFT == 13 */ diff -Nru a/include/asm-m68knommu/thread_info.h b/include/asm-m68knommu/thread_info.h --- a/include/asm-m68knommu/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-m68knommu/thread_info.h Sun Jun 8 00:40:15 2003 @@ -65,7 +65,7 @@ } /* thread information allocation */ -#define alloc_thread_info() ((struct thread_info *) \ +#define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, 1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h --- a/include/asm-parisc/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-parisc/thread_info.h Sun Jun 8 00:40:15 2003 @@ -37,7 +37,7 @@ #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) #define THREAD_SHIFT (PAGE_SHIFT + THREAD_ORDER) -#define alloc_thread_info() ((struct thread_info *) \ +#define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, THREAD_ORDER)) #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-ppc/thread_info.h b/include/asm-ppc/thread_info.h --- a/include/asm-ppc/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-ppc/thread_info.h Sun Jun 8 00:40:15 2003 @@ -54,7 +54,7 @@ } /* thread information allocation */ -#define alloc_thread_info() ((struct thread_info *) \ +#define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, 1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-ppc64/thread_info.h b/include/asm-ppc64/thread_info.h --- a/include/asm-ppc64/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-ppc64/thread_info.h Sun Jun 8 00:40:15 2003 @@ -52,7 +52,7 @@ #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) #define THREAD_SHIFT (PAGE_SHIFT + THREAD_ORDER) -#define alloc_thread_info() ((struct thread_info *) \ +#define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, THREAD_ORDER)) #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h --- a/include/asm-s390/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-s390/thread_info.h Sun Jun 8 00:40:15 2003 @@ -68,7 +68,7 @@ } /* thread information allocation */ -#define alloc_thread_info() ((struct thread_info *) \ +#define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL,THREAD_ORDER)) #define free_thread_info(ti) free_pages((unsigned long) (ti),THREAD_ORDER) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-sparc/thread_info.h b/include/asm-sparc/thread_info.h --- a/include/asm-sparc/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-sparc/thread_info.h Sun Jun 8 00:40:15 2003 @@ -78,7 +78,7 @@ #endif BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void) -#define alloc_thread_info() BTFIXUP_CALL(alloc_thread_info)() +#define alloc_thread_info(tsk) BTFIXUP_CALL(alloc_thread_info)() BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *) #define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti) diff -Nru a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h --- a/include/asm-sparc64/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-sparc64/thread_info.h Sun Jun 8 00:40:15 2003 @@ -142,10 +142,10 @@ /* thread information allocation */ #if PAGE_SHIFT == 13 -#define alloc_thread_info() ((struct thread_info *)__get_free_pages(GFP_KERNEL, 1)) +#define alloc_thread_info(tsk)((struct thread_info *)__get_free_pages(GFP_KERNEL, 1)) #define free_thread_info(ti) free_pages((unsigned long)(ti),1) #else /* PAGE_SHIFT == 13 */ -#define alloc_thread_info() ((struct thread_info *)__get_free_pages(GFP_KERNEL, 0)) +#define alloc_thread_info(tsk)((struct thread_info *)__get_free_pages(GFP_KERNEL, 0)) #define free_thread_info(ti) free_pages((unsigned long)(ti),0) #endif /* PAGE_SHIFT == 13 */ diff -Nru a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h --- a/include/asm-um/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-um/thread_info.h Sun Jun 8 00:40:15 2003 @@ -49,7 +49,7 @@ /* thread information allocation */ #define THREAD_SIZE (4*PAGE_SIZE) -#define alloc_thread_info() ((struct thread_info *) \ +#define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL,2)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 2) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-v850/thread_info.h b/include/asm-v850/thread_info.h --- a/include/asm-v850/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-v850/thread_info.h Sun Jun 8 00:40:15 2003 @@ -54,7 +54,7 @@ */ /* thread information allocation */ -#define alloc_thread_info() ((struct thread_info *) \ +#define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, 1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h --- a/include/asm-x86_64/thread_info.h Sun Jun 8 00:40:15 2003 +++ b/include/asm-x86_64/thread_info.h Sun Jun 8 00:40:15 2003 @@ -73,7 +73,7 @@ } /* thread information allocation */ -#define alloc_thread_info() \ +#define alloc_thread_info(tsk) \ ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER)) #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) #define get_thread_info(ti) get_task_struct((ti)->task) diff -Nru a/kernel/fork.c b/kernel/fork.c --- a/kernel/fork.c Sun Jun 8 00:40:15 2003 +++ b/kernel/fork.c Sun Jun 8 00:40:15 2003 @@ -65,15 +65,12 @@ return total; } -#ifdef CONFIG_IA64 -# define HAVE_ARCH_DUP_TASK_STRUCT +#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR +# define alloc_task_struct() kmem_cache_alloc(task_struct_cachep, GFP_KERNEL) +# define free_task_struct(tsk) kmem_cache_free(task_struct_cachep, (tsk)) + static kmem_cache_t *task_struct_cachep; #endif -#ifdef HAVE_ARCH_DUP_TASK_STRUCT -extern void free_task_struct (struct task_struct *tsk); -#else -static kmem_cache_t *task_struct_cachep; - /* * A per-CPU task cache - this relies on the fact that * the very last portion of sys_exit() is executed with @@ -81,7 +78,7 @@ */ static task_t *task_cache[NR_CPUS] __cacheline_aligned; -static void free_task_struct(struct task_struct *tsk) +static void free_task(struct task_struct *tsk) { /* * The task cache is effectively disabled right now. @@ -91,20 +88,19 @@ */ if (tsk != current) { free_thread_info(tsk->thread_info); - kmem_cache_free(task_struct_cachep,tsk); + free_task_struct(tsk); } else { int cpu = get_cpu(); tsk = task_cache[cpu]; if (tsk) { free_thread_info(tsk->thread_info); - kmem_cache_free(task_struct_cachep,tsk); + free_task_struct(tsk); } task_cache[cpu] = current; put_cpu(); } } -#endif /* HAVE_ARCH_DUP_TASK_STRUCT */ void __put_task_struct(struct task_struct *tsk) { @@ -114,7 +110,7 @@ security_task_free(tsk); free_uid(tsk->user); - free_task_struct(tsk); + free_task(tsk); } void add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) @@ -194,7 +190,7 @@ void __init fork_init(unsigned long mempages) { -#ifndef HAVE_ARCH_DUP_TASK_STRUCT +#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR /* create a slab on which task_structs can be allocated */ task_struct_cachep = kmem_cache_create("task_struct", @@ -220,10 +216,6 @@ init_task.rlim[RLIMIT_NPROC].rlim_max = max_threads/2; } -#ifdef HAVE_ARCH_DUP_TASK_STRUCT -extern struct task_struct *dup_task_struct (struct task_struct *orig); -#else /* !HAVE_ARCH_DUP_TASK_STRUCT */ - struct task_struct *dup_task_struct(struct task_struct *orig) { struct task_struct *tsk; @@ -236,13 +228,13 @@ task_cache[cpu] = NULL; put_cpu(); if (!tsk) { - ti = alloc_thread_info(); - if (!ti) + tsk = alloc_task_struct(); + if (!tsk) return NULL; - tsk = kmem_cache_alloc(task_struct_cachep, GFP_KERNEL); - if (!tsk) { - free_thread_info(ti); + ti = alloc_thread_info(tsk); + if (!ti) { + free_task_struct(tsk); return NULL; } } else @@ -258,8 +250,6 @@ return tsk; } -#endif /* !HAVE_ARCH_DUP_TASK_STRUCT */ - #ifdef CONFIG_MMU static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm) { @@ -1063,7 +1053,7 @@ atomic_dec(&p->user->processes); free_uid(p->user); bad_fork_free: - free_task_struct(p); + free_task(p); goto fork_out; }